using System;
using System.Collections.Generic;
using System.Text;
using Emlyn.Common.Tools.BusinessLayer;

namespace Emlyn.Website.Users
{
    public class EWebsite: BaseItem
    {
        public EWebsite()
            : base(true)
        {
        }

        public EWebsite(string aWebsiteCode)
            : base(false)
        {
            _websiteCode = aWebsiteCode;
        }

        private string _websiteCode;

        public string WebsiteCode
        {
            get { return _websiteCode; }
            set { _websiteCode = value; }
        }

        private int _version;

        public int Version
        {
            get { return _version; }
            set { _version = value; }
        }

        IList<User> _users = null;

        public IList<User> Users
        {
            get
            {
                if (_users == null)
                {
                    UserQuery luserQuery = new UserQuery();

                    _users = luserQuery.GetUsersForWebsiteCode(WebsiteCode);
                }

                return _users;
            }
        }

        public void Refresh()
        {
            _users = null;
        }
    }
}
